package com.example.pixelyear.utils.dialog

import android.annotation.SuppressLint
import android.content.Context
import android.util.Log
import com.example.pixelyear.Interface.OnDownloadCancelListener
import com.example.pixelyear.R
import com.example.pixelyear.utils.extension.setOnDoubleClickListener
import kotlinx.android.synthetic.main.dialog_progress.view.*

class ProgressDialog(context: Context) : BaseDialog(ctx = context) {
    private var listener: OnDownloadCancelListener? = null
    override fun getLayoutID(): Int {
        return R.layout.dialog_progress
    }

    override fun initAny() {
        setCancelable(false)
        setCanceledOnTouchOutside(false)
        rootView.Dialog_Progress_Cancel.setOnDoubleClickListener {
            listener?.cancel()
        }
    }

    fun updateProgress(progress: Int) {
        rootView.Dialog_Progress.progress = progress
        rootView.Dialog_Progress_TextProgress.text = "${progress}/100"
    }

    fun setOnProgressCancelListener(l: OnDownloadCancelListener) {
        this.listener = l
    }


}